package com.game.events
{
	import com.game.interfaces.IGameDispatcher;
	import com.net.interfaces.IDestroy;

	/**
	 * 游戏中事件派发处理
	 * @author hyy
	 *
	 */
	public class GameNotify implements IGameDispatcher, IDestroy
	{
		private var notify : GameEventDispatcher;

		public function GameNotify()
		{
			notify = GameEventDispatcher.getInstance();
		}

		public function addEventListener(type : String, listener : Function, useCapture : Boolean = false, priority : int = 0, useWeakReference : Boolean = false) : void
		{
			notify.addEventListener(type, listener, useCapture, priority, useWeakReference);
		}

		public function sendNotification(type : String, body : * = null) : Boolean
		{
			return notify.sendNotification(type, body);
		}

		public function hasEventListener(type : String) : Boolean
		{
			return notify.hasEventListener(type);
		}

		public function removeEventListener(type : String, listener : Function, useCapture : Boolean = false) : void
		{
			notify.removeEventListener(type, listener, useCapture);
		}

		public function sendError(... args) : void
		{
			sendNotification(GameEventType.ERROR, args);
		}

		public function destroy() : void
		{
			notify = null;
		}

		public function get isDestroy() : Boolean
		{
			return false;
		}
	}
}